interface canPlay{
	//可选的？要加在名字后面
        name:string  //未赋值
        age?:number  // 可选属性
        say():void   //未实现
       sing?():void  // 可选函数，以后这个方法可以实现也可以不实现
}
//实现
class A implements canPlay{//重写属性和方法
      name:string
      constructor(name){
          this.name = name
      }
      say():void{
          console.log(this.name+"说：你好")
      }
}
let a1:A = new A("小明")
a1.say()

interface myCom{
     name:string
     getContent():void
}
class Dogs implements myCom{    
     name:string
     constructor(name){
         this.name = name
     }
     getContent():void{
         console.log("Dog对象")
     }
}
function show1(d:myCom):void{//接口可以当类型 或者具有一些相同特征的类型
     d.getContent()
}
let d2 = new Dogs("金毛")
show1(d2)

class Car implements myCom{
    name:string
    constructor(name){
        this.name = name
    }
    getContent():void{
        console.log("Car对象")
    }
}
let c1 = new Car("比亚迪.宋")
show1(c1)

